package com.typy.www.tpay.util;

import android.graphics.Bitmap;
import android.support.v4.util.LruCache;

import com.android.volley.toolbox.ImageLoader.ImageCache;

public class ImageMemCache extends LruCache<String, Bitmap> implements ImageCache {
	
	
	
	public ImageMemCache(int cacheSize) {
		super(cacheSize);
	}
	
	@Override
    protected int sizeOf(String key, Bitmap bitmap) {
		return bitmap == null ? 0 : bitmap.getRowBytes() * bitmap.getHeight();
	}
	
	@Override
	public Bitmap getBitmap(String url) {
		return get(url);
	}

	@Override
	public void putBitmap(String url, Bitmap bitmap) {
		put(url, bitmap);
	}

}
